var qqcs;

$(function () {
    $(window).resize(function(){
        setTimeout(function () {
            fitCoulms();
        },300);
    });
    $("#endMarker").text("查询历史");
    $("#list-Gn .active").removeClass("active");
    $("#itemCzls").addClass("active");
    //表格初始化
    initDataGrid();
    //查询数据
    queryJlLb();
});


//分页查询
function queryJlLb() {
    var cxrqq = $('#cxrqq').val();
    var cxrqz = $('#cxrqz').val();
    if ("" == cxrqq) {
        innerToast.warn("请选择查询日期起!");
    } else if ("" == cxrqz) {
        innerToast.warn("请选择查询日期止!");
    } else {
        qqcs = {"cxrqq": cxrqq, "cxrqz": cxrqz};
        //查询开始
        $('#tt').datagrid('clearSelections');
        $('#tt').datagrid({url: "/portal/user/statistics/queryGnDjLb.do", queryParams: qqcs});
    }
}

//初始化表格
function initDataGrid() {
    // 主表格
    var fields = [[{
        title: '功能名称',
        field: 'text',
        sortable: false,
        width: 200,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }, {
        title: '时间',
        field: 'sj',
        sortable: false,
        width: 200,
        formatter: function (value) {
            if (null == value) {
                value = "";
            }
            return "<span title='" + value + "'>" + value + "</span>";
        }
    }]];

    $('#tt').datagrid({
        collapsible: false,
        rownumbers: true,
        remoteSort: false,
        nowrap: true,
        striped: true,
        fitColumns: true,
        singleSelect: true,
        fit: false,
        pagination: true,
        columns: fields
    });
}

/*
function addjl() {
    try {
        qqcs = {"gnid": "xtgl-jscdwh"};
        $.ajax({
            url: "/portal/user/statistics/saveGnDjs.do",
            data: qqcs,
            type: "post",
            timeout: sys_timeout,
            dataType: "json",
            async: false,
            error: function (XMLHttpRequest, textStatus) {
            },
            success: function (respText) {
            }
        });
    } catch (e) {

    }
}*/
